<?php

namespace app\api\server\coupon;

use app\api\model\coupon\CouponApiModel;
use app\api\model\music\MusicApiModel;
use app\api\model\user\UserCouponApiModel;
use app\api\ServerBase;
use think\Request;

class CouponServer extends ServerBase
{
    protected $model;
    protected $request;
    /**
     * @var UserCouponApiModel
     */
    private $userCouponModel;

    function __construct(Request $request)
    {
        $this->request = $request;
        $this->param = $request->param();
        $this->model = new CouponApiModel();
        $this->userCouponModel = new UserCouponApiModel();
    }

    function getList(){
        [$page, $limit] = $this->getPage($this->param);
        $this->param['status'] = 1;
        $field='id,title,num,enough_price,price,expire_days,create_time';
        [$list, $count] = $this->model->getApiList($this->param,$field,$page,$limit);
        $result['data']=$list;
        $result['count']=$count;
        $this->getMessageCode('adminMessage.success.select',2);
        return $result;
    }
}